package com.googlecode.spoluyan.myshows;

public class Defines {
    public static final String CLIENT_VERSION = "1.0";
    public static final String API_VERSION = "1.5";

    public static final String ENCODING = "UTF-8";

    public static final String QUESTION_MARK = "?";
    public static final String EQUALS_SIGN = "=";
    public static final String AMPERSAND = "&";
    public static final String SEMICOLON = ";";
    public static final String SLASH = "/";
    public static final String COMMA = ",";
    public static final String EMPTY_STRING = "";
    public static final String ZERO = "0";
    public static final String ENCODING_ALG = "MD5";

    public static final String API_URL = "http://api.myshows.ru/";

    public static final String COOKIE = "Cookie";
    public static final String COOKIE_HEADER = "Set-Cookie";

    public static class Path {
	public static final String PROFILE = "profile/";
	public static final String LOGIN = "login";
	public static final String SHOWS = "shows/";
	public static final String EPISODES = "episodes/";
	public static final String EPISODES_WITH_PARAMS = "episodes";
	public static final String UNWATCHED = "unwatched/";
	public static final String NEXT = "next/";
	public static final String CHECK = "check/";
	public static final String UNCHECK = "uncheck/";
	public static final String SYNC = "sync";
	public static final String RATE = "rate/";
	public static final String FAVORITES = "favorites/";
	public static final String LIST = "list/";
	public static final String IGNORED = "ignored/";
	public static final String NEWS = "news/";
	public static final String SEARCH = "search/";
	public static final String FILE = "file/";
	public static final String GENRES = "genres/";
	public static final String TOP = "top/";
    }

    public static class Parameter {
	public static final String LOGIN = "login";
	public static final String PASSWORD = "password";
	public static final String RATING = "rating";
	public static final String EPISODES = "episodes";
	public static final String CHECK = "check";
	public static final String UNCHECK = "uncheck";
	public static final String QUERY = "q";
    }

    public static class ErrorMessage {
	public static final String LOGIN_OR_PASSWORD_IS_EMPTY = "Login or password is empty.";
	public static final String LOGIN_OR_PASSWORD_IS_INCORRECT = "Login or password is incorrect.";
	public static final String MD5_IS_NOT_SUPPORTED = "Your environment doesn't support " + ENCODING_ALG
		+ " encoding algorithm.";
	public static final String ENCODING_IS_NOT_SUPPORTED = "Your environment doesn't support " + ENCODING
		+ " encoding.";
	public static final String SHOW_ID_CAN_NOT_BE_NULL = "Parameter showId can not be null.";
	public static final String EPISODE_ID_CAN_NOT_BE_NULL = "Parameter episodeId can not be null.";
	public static final String STATUS_CAN_NOT_BE_NULL = "Parameter status can not be null.";
	public static final String INCORRECT_RATING = "Rating should be from 1 to 5.";
	public static final String COMMAND_CAN_NOT_BE_NULL = "Parameter cmd can not be null.";
	public static final String UNABLE_TO_CONNECT_TO = "Unable to connect to " + API_URL + ".";
	public static final String INCORRECT_URL = "MalformedURLException. Incorrect URL.";
	public static final String CHECK_AND_UNCKECK_CAN_NOT_BE_NULL = "Parameters check and uncheck can not be null or empty.";
	public static final String GENDER_CAN_NOT_BE_NULL = "Parameter gender can not be null.";
    }

    public static enum Status {
	WATCHING("watching"), LATER("later"), CANCELLED("cancelled"), REMOVE("remove");

	private String name;

	Status(String name) {
	    this.name = name;
	}

	public String getName() {
	    return name;
	}

	public static Status fromName(String name) {
	    for (Status t : Status.values()) {
		if (t.name.equals(name)) {
		    return t;
		}
	    }
	    throw new IllegalArgumentException("Invalid Status name " + name);
	}
    }

    public static enum Command {
	ADD("add"), REMOVE("remove");

	private String name;

	Command(String name) {
	    this.name = name;
	}

	public String getName() {
	    return name;
	}

	public static Command fromName(String name) {
	    for (Command t : Command.values()) {
		if (t.name.equals(name)) {
		    return t;
		}
	    }
	    throw new IllegalArgumentException("Invalid Command name " + name);
	}
    }

    public static enum Gender {
	MALE("male"), FEMALE("female"), ALL("all");

	private String name;

	Gender(String name) {
	    this.name = name;
	}

	public String getName() {
	    return name;
	}

	public static Gender fromName(String name) {
	    for (Gender t : Gender.values()) {
		if (t.name.equals(name)) {
		    return t;
		}
	    }
	    throw new IllegalArgumentException("Invalid Gender name " + name);
	}
    }
}
